//
//  iRSocket.h
//  iRSocketTest
//
//  Created by 胡鹏飞 on 15/8/7.
//  Copyright (c) 2015年 胡鹏飞. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AsyncSocket.h"
@class iRSocket;
@protocol iRSocketDelegate <NSObject>

- (void)connectSuccess:(iRSocket *)socket;
- (void)connectFailedWithError:(NSError *)error;
- (void)receivedMessage:(NSData *)data;
- (void)sendMessageSuccessed:(iRSocket *)socket;
- (void)sendMessageFailedWithError:(NSError *)error;
- (void)sockeDisconnected:(iRSocket *)socket;

@end


@interface iRSocket : NSObject<AsyncSocketDelegate>
{
    AsyncSocket *_socket;
}

@property (weak) id<iRSocketDelegate> delegate;
@property (nonatomic, assign) BOOL isRequesting;
@property (nonatomic, retain) NSString *beforSendContent;
@property (nonatomic, retain) NSString *Ip;
@property (nonatomic, assign) int port;
@property (nonatomic, assign) BOOL isConnecting;
@property (nonatomic, retain) NSMutableArray *dataSource;

+ (iRSocket *)defaultSocket;
- (BOOL)connectTheServerWithIP:(NSString *)ip andPortNum:(int)port;
- (void)sendMessage;


- (void)dissConnect;

@end
